package com.lxitedu.chain.processor;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class Access {

  public static void executeSql(String dbfile, String sql) {
    try {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      Connection con = DriverManager.getConnection(
          "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)}; DBQ=" + dbfile,
          "", "");
      Statement statement = con.createStatement();
      statement.execute(sql);
      statement.close();
      con.close();
    } catch (SQLException a) {
      System.out.println(a.getMessage());
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    }
  }

}
